package com.deepblue.image.maker.api;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
import com.deepblue.image.maker.common.CommonResult;
import com.deepblue.image.maker.config.FreemakerProperties;
import com.deepblue.image.maker.constants.CommonConstants;
import com.deepblue.image.maker.domain.freemaker.Dockerfile;
import com.deepblue.image.maker.domain.vo.req.CreateDockerfileVO;
import com.deepblue.image.maker.enums.BusinessEnum;
import com.deepblue.image.maker.service.DockerfileService;
import com.deepblue.image.maker.util.CommonResultUtil;
import com.deepblue.image.maker.util.FreemakerUtil;
import com.spotify.docker.client.DockerClient;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.io.IOException;

/**
 * dockerfile 接口
 *
 * @author yymagicer
 * @version 1.0
 * @date 2021/11/9 上午9:28
 */
@RestController
@RequestMapping("/dockerfile")
@Api(value = "dockerfile 接口管理",tags = "dockerfile 接口管理")
public class DockerFileApi {


    @Resource
    private DockerfileService dockerfileService;


    @PostMapping("/create")
    @ApiOperation("生成dockerfile")
    public CommonResult<String>  create(@Validated @RequestBody CreateDockerfileVO vo){
        Dockerfile dockerfile = BeanUtil.toBean(vo, Dockerfile.class);
        return CommonResultUtil.success(dockerfileService.create(dockerfile));
    }
}
